package cc.home.work.demo3;

//要求:在测试类Test中创建A的对象a并调用成员方法methodA(),要求用两种方式实现

import cc.home.work.demo2.Inter;

public class Test {
    public static void main(String[] args) {
        A a = new A();
        a.methodA(new InterA() {
            @Override
            public void showA() {
                System.out.println("我不懂");
            }
        });


        InterAImpl a1 = new InterAImpl();
        a1.showA();


    }
}

//定义接口
interface InterA {
    void showA();
}

class A {
    public void methodA(InterA a) {
        a.showA();
    }
}

class InterAImpl implements InterA {
    @Override
    public void showA() {
        System.out.println("还是不懂");
    }
}
